
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets" template="/template/main.xhtml">

	<ui:define name="body">
		<h:form>
			<p:toolbar rendered="#{emitenteListMB.podeInserir}">
				<f:facet name="left">
					<p:commandButton title="#{messages['button.new']}" icon="ui-icon-document" action="#{emitenteListMB.getNextView}"
						actionListener="#{emitenteListMB.clear}" ajax="false"  />
				</f:facet>
			</p:toolbar>
			<p:dataTable id="list" var="bean" value="#{emitenteListMB.resultList}">
				<f:facet name="header">#{messages['emitente.list.table.title']}</f:facet>
				<p:column width="15%" sortBy="#{bean.documento}">
					<f:facet name="header">#{messages['idDocumento']}</f:facet>
					<h:commandLink action="#{emitenteListMB.getNextView}" actionListener="#{emitenteListMB.clear}">
						<h:outputText value="#{bean.documento}" >						
						<f:converter converterId="CnpjCpfConverter" />
						</h:outputText>
						<f:param name="id" value="#{bean.id}" />
					</h:commandLink>
				</p:column>

				<p:column sortBy="#{bean.nome}">
					<f:facet name="header">#{messages['emitente.label.nome']}</f:facet>
					<h:commandLink action="#{emitenteListMB.getNextView}" actionListener="#{emitenteListMB.clear}">
						<h:outputText value="#{bean.nome}" />
						<f:param name="id" value="#{bean.id}" />
					</h:commandLink>
				</p:column>

				<p:column width="2%">
					<f:facet name="header">#{messages['label.uf']}</f:facet>
					<h:commandLink action="#{emitenteListMB.getNextView}" actionListener="#{emitenteListMB.clear}">
						<h:outputText value="#{bean.endereco.estado.sigla}" />
						<f:param name="id" value="#{bean.id}" />
					</h:commandLink>
				</p:column>
				<p:column width="20%">
					<f:facet name="header">#{messages['label.cidade']}</f:facet>
					<h:commandLink action="#{emitenteListMB.getNextView}" actionListener="#{emitenteListMB.clear}">
						<h:outputText value="#{bean.endereco.municipio.nome}" />
						<f:param name="id" value="#{bean.id}" />
					</h:commandLink>
				</p:column>

			</p:dataTable>
		</h:form>

	</ui:define>
</ui:composition>